package com.springboot.others.mapper;

import com.springboot.others.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {
    @Delete("delete from user where id = #{id}")
    int deleteByPrimaryKey(Integer id);

    @Insert("insert into user values (#{id},#{name})")
    @Options(useGeneratedKeys = true,keyProperty = "id")
    User insert(User record);
    @Select("select * from user where id = #{id}")
    User selectByPrimaryKey(Integer id);
    @Update("update user set name = #{name} where id = #{id}")
    int updateByPrimaryKeySelective(User record);

    @Select("select * from user")
    List<User> selectAll();

}
